<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/8 0008
 * Time: 上午 9:22
 */
require APPPATH."/controllers/Common.php";

class Login extends Common
{
    function index(){

    }

    function api(){
        $name = $this->req("name");
        $mobile = $this->req("mobile");
        $password = $this->req("password");
        $password = $this->pwd($password);
        $this->load->model('user');
        $res = User::findByName($name,$password);
        if(empty($res)){
            $res = User::findByMobile($mobile,$password);
        }
        $code = $res?1000:1010;
        $msg = $res?"success":"error";
        return $this->resp_api([],$code,$msg);
    }
}